package com.itee.protocal.concent;


import com.itee.core.util.StringCoder;

/**
 * Created by Administrator on 2014/10/11.
 * 372.2协议，路由状态信息  AFN10H + FN04H;
 */
public class NetWorkRouteInfo {

    private byte[] datas;

    private boolean isRouteFinish;//1为路由完成，0为未完成

    private boolean isRegistered;//1为允许注册，

    private String dauAmounts;//从节点总数

    private String relayingDauAmounts;//已抄从节点

    private String notRelayingDauAmounts;//中继抄到从节点

    public String getComRate() {
        return comRate;
    }

    public void setComRate() {
        byte[] buf =new byte[2];
        buf[0] =datas[9];
        buf[1] =datas[8];
        this.comRate = StringCoder.bytesToHexString(buf)+"Bps";
    }

    public String getNotRelayingDauAmounts() {
        return notRelayingDauAmounts;
    }

    public void setNotRelayingDauAmounts() {
        byte[] buf =new byte[2];
        buf[0] =datas[4];
        buf[1] =datas[3];
        this.notRelayingDauAmounts = StringCoder.bytesToHexString(buf);
    }

    public String getRelayingDauAmounts() {
        return relayingDauAmounts;
    }

    public void setRelayingDauAmounts() {
        byte[] buf =new byte[2];
        buf[0] =datas[6];
        buf[1] =datas[5];
        this.relayingDauAmounts = StringCoder.bytesToHexString(buf);
    }

    public String getDauAmounts() {
        return dauAmounts;
    }

    public void setDauAmounts() {
        byte[] buf =new byte[2];
        buf[0] =datas[2];
        buf[1] =datas[1];
        this.dauAmounts = StringCoder.bytesToHexString(buf);
    }

    public boolean isRegistered() {
        return isRegistered;
    }

    public void setRegistered() {
        byte buf =datas[7];
        this.isRegistered = ((buf&0x2)==2);
    }

    public boolean isRouteFinish() {
        return isRouteFinish;
    }

    public void setRouteFinish() {
        byte buf =datas[0];
        this.isRouteFinish = ((buf&0x01)==1);
    }

    private String comRate;


    public NetWorkRouteInfo(byte[] datas) {
        this.datas =datas;
    }

}
